<%@ include file="/common/taglibs.jsp"%>
<!--分页查询共用的页面-->
<%@ include file="/common/common.jsp"%>
<%@ include file="/common/dateUtil.jsp"%>
<%@ page language="java" pageEncoding="UTF-8"%>

<head>

 



<script>

//////////////////////////////////////////////////////////////变量
var dap_dis_fast = {};//定义数据处理模块中不连续轨迹操作对象
dap_dis_fast.debug = true;

//////////////////////////////////////////////////////////////初始化控件
//初始化表格
$(function(){
    //初始化表格
    $("#dap_dis_fast_datagrid").datagrid({
        height:"100%",
        toolbar:"#dap_dis_fast_toolbar",//工具条
        pagination:true,//分页工具栏
		pageList:[30,50,100,200],
		pageSize:30,
		singleSelect:true,//单选
		rownumbers:true,//行号
		striped:true,//隔行变色
		fitColumns: true,//填充列
		checkOnSelect: false,//选中则勾选
		selectOnCheck: false,//勾选则选中
    });
});


//接口，初始化相关控件
dap_dis_fast.initDivs = function(){
    this.initDepDiv();
    this.initPaginationDiv();
    this.initDateDiv();
}

//初始化下拉部门树
dap_dis_fast.initDepDiv = function(){
    //创建下拉部门树
    Utility.createDepTree("dap_dis_fast_depName");
}

//初始化分页控件点击事件
dap_dis_fast.initPaginationDiv = function(){
    let that = this;
    //选择页面事件定义
    $("#dap_dis_fast_datagrid").datagrid("getPager").pagination({
        onSelectPage: function (pageNumber, pageSize) {
            that.queryAllData(pageNumber);
        }
    });
}

dap_dis_fast.initDateDiv = function(){
    let today = Utility.today();
    // let h20 = new Date().getTime() - 1000 * 60 * 60 * 20;
    // let h20Str = Utility.dateToString(new Date(h20));
    $("#dap_dis_fast_StartDate").val(today + ' 00:00:00');

    // let h12 = new Date().getTime() - 1000 * 60 * 60 * 12;
    // let h12Str = Utility.dateToString(new Date(h12));
    $("#dap_dis_fast_EndDate").val(today + ' 23:59:59');
}







//////////////////////////////////////////////////////////////加载数据

//查询数据
dap_dis_fast.queryAllData = function(pageNum){
    let that = this;
    let param = this.getQueryParam();
    if(param.parseMsg == ""){
        if(!DataUtil.isDefined(pageNum) &&  pageNum > 0){
            param.pageNumber = pageNum;
            // that.outDebug('param : ' , param);
             
        }
        let url = globalConfig.webPath + "/basicSlctAction/basicSelectPaginationData.action";  
        // let url = globalConfig.webPath + "/dataProcess/getDiscontinuityData.action";

        Utility.getAjaxData(url, JSON.stringify(param), function (data) {
            that.outDebug("接收到不连续轨迹超速位移数据：", data);
            if (data.success) {
                $("#dap_dis_fast_datagrid").datagrid("loadData", data.data);
            } else {
                DataUtil.showErrorMsg(data.message);
            }
        });
            // DataUtil.showMsg("开始查询!");
    }else{
        DataUtil.showErrorMsg(param.parseMsg);
    }
}


//获取查询相关参数
dap_dis_fast.getQueryParam = function(){
    let param = {};
    try {
        let formTemp = document.getElementById("dap_dis_fast_slctForm");
        let formData = new FormData(formTemp);
        param = DataUtil.parseFormData2Obj(formData);

        if(!DataUtil.isDefined(param.outList_str)){
            if(param.outList_str != ""){
                let list = param.outList_str.split(",");
                if(list.length > 0){
                    param.outList = list;
                }
            }
        }

        if(!DataUtil.isDefined(param.depId) && param.depId == "0"){
            delete param.depId;
        }

        
        // this.outDebug("18h:" + h18);
        // if(DataUtil.isDefined(param.startDate)){
        //     //如果起始时间为空，则添加为当前时间18小时以前的
        //     param.startDate = h18Str;
        //     $("#dap_dis_StartDate").val(h18Str);
        // }else{
        //     //不为空,则取最近
        //     let startTemp = new Date(param.startDate).getTime();
        //     // this.outDebug("startTimeLong :" + startTemp);
        //     if(startTemp < h18){
        //         param.startDate = h18Str;
        //         $("#dap_dis_StartDate").val(h18Str);
        //     }
        // }

        param.pageNumber = $("#dap_dis_fast_datagrid").datagrid("getPager").data("pagination").options.pageNumber;
	    param.pageSize = $("#dap_dis_fast_datagrid").datagrid("getPager").data("pagination").options.pageSize;
    } catch (error) {
        param.parseMsg += "获取查询参数失败：" + error;
    }
    return param;
}




//////////////////////////////////////////////////////////////datagrid数据格式化






//////////////////////////////////////////////////////////////控件事件

//选择车组
dap_dis_fast.doSelectDep = function(){
	InfoWindow.selectDep();
}

//设置车组信息回调方法，用于查找数组
function onDepSelected(depId,depName){
    dap_dis_fast.outDebug('开始设置车组名称');
	$("#dap_dis_fast_depName").combotree("setValue", depId);
}

//清空时间事件
dap_dis_fast.reset = function(){
    $("#dap_dis_fast_plateNo").val("");
    // $("#dap_dis_fast_depName").val(0);
    $("#dap_dis_fast_depName").combotree('setValue',0);
    $("#dap_dis_fast_StartDate").val("");
    $("#dap_dis_fast_EndDate").val("");
    $("#dap_dis_fast_outList").val("");
}
    


//////////////////////////////////////////////////////////////公共方法

//输出调试信息
dap_dis_fast.outDebug = function(msg,data){
    if(this.debug == true){
        DataUtil.outDebug(msg,data);
    }
}



//////////////////////////////////////////////////////////////加载后执行
$(document).ready(function(){
    dap_dis_fast.outDebug("ready");
    dap_dis_fast.initDivs();//初始化控件
});
</script>

</head>
<body style="min-width:1000px;overflow:auto;">
<div id="dap_dis_fast_toolbar" class="sh_css_basFontSize">
    <form id="dap_dis_fast_slctForm" action="<%=ApplicationPath%>/export.action">
        <input type="hidden" name="queryId" value="dataProcess.selectdisConFastDatas" />
        <table class="TableBlock" style="width:100%;">
            <tr>
                <td>
                    <div>
                        <span>车牌号码:</span>
                        <input id="dap_dis_fast_plateNo" class="base_inputImpBorder_css" type="text" name="plateNo" style="width:170px;">
                    </div>
                </td>
                <td>
                    <div>
                        <span>车组名称:</span>
                        <select id="dap_dis_fast_depName" name="depId" style="width:170px;"></select>
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                            onclick="dap_dis_fast.doSelectDep();"></a>
                    </div>
    
                </td>
                <td colspan="2">
                    <div>
                        <span>位移起止时间：</span>
                        <input type="text" name="startDate" id="dap_dis_fast_StartDate" class="datetimepicker base_inputImpBorder_css" 
                        style="width:140px;" />
                        <span>  --  </span>
                        <input type="text" name="endDate" id="dap_dis_fast_EndDate" class="datetimepicker base_inputImpBorder_css" 
                        style="width:140px;" />
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <div>
                        <span>屏蔽车牌号：</span>
                        <input type="text" id="dap_dis_fast_outList" name="outList_str" class="base_inputImpBorder_css" style="width:220px;"/>
                        <span>(备注：多个车牌号用逗号隔开)</span>
                    </div>
                </td>
                <td colspan="2" align="left">
                    <!-- <a id="allAlarmAtnQuery" href="#" class="easyui-linkbutton"
                     data-options="iconCls:'icon-search'" onclick="dap_dis_fast.queryAllData(1);">查询</a> -->
                    <div class="base_hori_flexStartDiv_css">
                        <div id="allAlarmAtnQuery" class="sh_css_btn" onclick="javascript:dap_dis_fast.queryAllData(1);">
                            <div class="ui-icon icon-search" style="width:16px;height:16px;"></div>
                            <span>查询</span>
                        </div>&nbsp;
                        <a id="allAlarmBtnReset" href="#" class="easyui-linkbutton" 
                            data-options="iconCls:'icon-clear'" onclick="dap_dis_fast.reset();">重置</a>&nbsp;
                        <!-- <a id="allAlarmBtnExport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'">导出</a> -->
                    </div>
                </td>
            </tr>
        </table>
    </form>
</div>
<table id="dap_dis_fast_datagrid" class="easyui-datagrid">
    <thead>
        <tr>
            <th data-options="field:'plateNo'" width="80">车牌号</th>
            <th data-options="field:'depName'" width="90">车组</th>

            <th data-options="field:'upSendTime'" width="130">开始时间</th>
            <th data-options="field:'sendTime'" width="130">结束时间</th>

            <th data-options="field:'upLongitude'" width="100">开始经度</th>
            <th data-options="field:'upLatitude'" width="100">开始纬度</th>
            <th data-options="field:'upVelocity'" width="65">开始速度</th>

            
            <th data-options="field:'longitude'" width="100">结束经度</th>
            <th data-options="field:'latitude'" width="100">结束纬度</th>
            <th data-options="field:'velocity'" width="65">结束速度</th>

            <th data-options="field:'mileage'" width="90">起点里程数(Km)</th>
            <th data-options="field:'distance'" width="90">位移距离(Km)</th>
            <th data-options="field:'speed'" width="90">平均速度(Km/h)</th>
        </tr>
    </thead>
</table>
</body>